package love.yuanmengrobot.guoyitang.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import love.yuanmengrobot.guoyitang.entity.TbNatmehaRegisterRef;
import love.yuanmengrobot.guoyitang.service.AppointmentService;
import love.yuanmengrobot.guoyitang.utils.DataGridView;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*
 *   @Studio:CHJY · 源梦科技
 *   @Author:COOLIGHT
 *   @Ide:IntelliJ IDEA
 *   @Creation time:2021/8/11 0011 14:49
 */
@RestController
@CrossOrigin
@RequestMapping("appointment")
public class AppointmentController {
    private final AppointmentService service;

    public AppointmentController(AppointmentService service) {
        this.service = service;
    }

    @RequestMapping("/findAllHospital")
    public DataGridView findAllHospital(int page) {
        return new DataGridView(service.findAllHospital(new Page<>(page, 10)).getRecords());
    }

    @RequestMapping("/findAllDoctor")
    public DataGridView findAllDoctor(String hospital_code) {
        return new DataGridView(service.findAllDoctor(hospital_code));
    }

    @RequestMapping("/addRegisterRef")
    public String addRegisterRef(TbNatmehaRegisterRef entity) {
        return service.addRegisterRef(entity);
    }
}
